package controllers

import (
	"github.com/astaxie/beego"
)

type Demo1Controller struct {
	beego.Controller
}

func (this *Demo1Controller) Get() {
	//动态路由获取
	id :=this.Ctx.Input.Param(":id")  //参数要和路由中形式一致
	beego.Info(id)
	this.Ctx.WriteString(id)
}

func (this *Demo1Controller) ReGet() {
	//路由伪静态
	id :=this.Ctx.Input.Param(":id")  //参数要和路由中形式一致
	beego.Info(id)
	this.Ctx.WriteString(id)
}


func (this *Demo1Controller) Post() {
	str := this.GetString("s")
	beego.Info(str)
	//this.Ctx.WriteString(str)
	if str == "go"{
		/*
		两种区别：
			使用tpl静态页面跳转可以携带数据，如 this.Data["msg"] = "msg"
			redirect跳转不能携带数据，速度快
		*/
		//this.TplName = "xxx.html"
		this.Redirect("/models", 302)
		//this.Ctx.Redirect(302, "/models")
	}
}
